/**
 * Copyright (C) 2011 Daniel Centore
 * 
 * This file is part of WriteIn.
 *
 * WriteIn is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * WriteIn is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WriteIn.  If not, see <http://www.gnu.org/licenses/>.
 *  
 */
package in.write.data.pagehierarchy;

import in.write.data.stored.PreferenceManager;

import java.awt.Graphics;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.util.ArrayList;
import java.util.List;

/**
 * Represents an entire document, with {@link Page}s inside it
 * 
 * @author Daniel Centore
 * 
 */
public class Document implements Printable
{
	private List<Page> pages;
	
	public Document()
	{
		pages = new ArrayList<Page>();
		
		pages.add(new Page(PreferenceManager.getDouble(PreferenceManager.DEFAULT_WIDTH), PreferenceManager.getDouble(PreferenceManager.DEFAULT_HEIGHT))); // add first page
	}

	public List<Page> getPages()
	{
		return pages;
	}
	
	public void addPage(Page p, Page after)
	{
		pages.add(pages.indexOf(after) + 1, p);
	}

	@Override
	public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
	{
		// TODO Auto-generated method stub
		return 0;
	}
	
}
